package com.yu.waterstation.system.modules.app.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yu.waterstation.common.entity.app.Student;
import com.yu.waterstation.common.entity.system.vo.StudentVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @since 2020-12-02 18:08:14
 */
public interface StudentMapper extends BaseMapper<Student> {


    /**
     * 模糊查询
     * @param username
     * @param name
     * @param rowStart  开始行数 = (pageNo - 1) * pageSize
     * @param pageSize  页面大小
     * @return
     */
    List<StudentVO> searchStudents(@Param("username") String username, @Param("name") String name,
                                   @Param("rowStart") int rowStart, @Param("pageSize") int pageSize);

    /**
     * 重置学员寝室(或移除寝室)
     *
     * @param id
     * @return
     */
    @Update("update student set address_id = NULL where id = #{id};")
    int removeAddressOfStudent(Integer id);

}
